import React from 'react';
import PropTypes from 'prop-types';
import {Button, Form, Row, Col, Spin, Collapse} from 'antd';
import {FORM_OPTIONS, FORM_ROW_OPTIONS} from '../constants';
import {PERMISSION, claimStatusSale} from './constants';
import {repairType, dealerType, faultType, claimStatus} from '../Enum';
import TextInput from 'Shared/components/TextInput';
import WrappedSelect from '../common/WrappedSelect';
import DateRangePicker from 'Shared/components/DateRangePicker';
import TagSelect from 'Shared/components/TagSelect';
import DealerSelectPanel from '../common/DealerSelect/SelectEdit';
import SearchSelect from 'Shared/components/SearchSelect';
import PartCategorySelectPanel from './PartCategorySelectPanel';
import FaultItemSelectPanel from '../common/FaultItemSelect/SelectEdit';
import WrappedPopconfirm from '../common/WrappedPopconfirm';
import MultipleSelect from '../common/MultipleSelect';
import {hasPermissions} from './utils';
import {injectIntl, language} from './intl';
import Export from '../common/Export';
import routes from './routes';
import {getPartCategoryQuickly, autoData} from './api';
import styles from './style.css';
const FormItem = Form.Item;
const {Panel} = Collapse;

const repairTypeList = repairType.toList(language);
const faultTypeList = faultType.toList(language);
const dealerConditions = {
    type: dealerType.总代
};

class QueryPanel extends React.PureComponent {
    state = {
        loading: false,
        showPartCategory: false,
        showFaultItem: false,
    }
    handleFilterChange = (value, name) => {
        this.props.onConditionsChange(name, value);
    }
    handleFilterPressEnter = (value, name) => {
        this.props.onConditionsChange(name, value);
        this.props.querySearch();
    }
    labelMap = d => {
        if(d.id === undefined)
            return '';
        if(d)
            return `(${d.code}) ${d.name}`;
        return '';
    }
    handleFilterBatchPrint = () => {
        this.props.onClickBatchPrintBtn();
    }
    onSelectDealer = data => {
        this.props.onConditionsChange('dealerId', data.id);
        this.props.onQueryDealerChange({
            id: data.id,
            code: data.code,
            name: data.name,
        });
    }
    onSearchPartCategory = value =>
        getPartCategoryQuickly({
            query: value
        })
            .then(res => {
                const data = res.data;
                if(data)
                    return data.content;
            });
    onSelectPartCategory = data => {
        this.props.onConditionsChange('causePartCategoryId', data.id);
        this.props.onQueryPartCategoryChange({
            id: data.id,
            code: data.code,
            name: data.name,
        });
        this.setState({
            showPartCategory: false
        });
    }
    onClickPartCategory = () => {
        this.setState({showPartCategory: true});
    }
    onClosePartCategory = () => {
        this.setState({showPartCategory: false});
    }
    onClickAutoBtn = () => {
        this.setState({loading: true});
        autoData()
            .then(res => {
                this.setState({loading: false});
                if(res.ok)
                    this.props.querySearch();
            });
    }
    
    onClickFaultItem = data => {
        this.props.onConditionsChange('faultItemId', data.id);
        this.props.onQueryFaultItemChange({
            id: data.id,
            code: data.code,
            name: data.name,
        });
    }
    onClickStopPropagation = e => {
        e.stopPropagation();
    }
    onClickDownload = () => {
        this.props.onConditionsChange('isDownload', true);
        this.props.querySearch();
        this.props.onClickDownloadBtn();
    }
    render() {
        const isShowBatchPrintPanel = this.props.isShowBatchPrintPanel;
        const isShowDownloadPanel = this.props.isShowDownloadPanel;
        const operations = [];
        const dealerInfo = this.props.conditions.dealerId ? {
            id: this.props.queryDealer.id,
            code: this.props.queryDealer.code,
            name: this.props.queryDealer.name
        } : null;
        const partCategoryInfo = this.props.conditions.causePartCategoryId ? {
            id: this.props.queryPartCategory.id,
            code: this.props.queryPartCategory.code,
            name: this.props.queryPartCategory.name
        } : null;
        const faultItemInfo = this.props.conditions.faultItemId ? {
            id: this.props.queryFaultItem.id,
            code: this.props.queryFaultItem.code,
            name: this.props.queryFaultItem.name
        } : null;
        if(!isShowBatchPrintPanel && !isShowDownloadPanel) {
            if(hasPermissions(this.props.permissions, PERMISSION.download))
                operations.push(<Button key="download" onClick={this.onClickDownload}>{this.props.intl.formatMessage({
                    id: 'queryPanel.btn.download',
                    defaultMessage: '附件批量下载'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.upload))
                operations.push(<Button key="upload" href={`#${routes.upload.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.upload',
                    defaultMessage: '附件批量上传'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.usedLabelPrint))
                operations.push(<Button key="usedLabelBatchPrint" onClick={this.handleFilterBatchPrint}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.usedLabelBatchPrint',
                    defaultMessage: '旧件标签批量打印'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.querySearch))
                operations.push(<Button key="querySearch" href={`#${routes.historyQuery.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.querySearch',
                    defaultMessage: '历史查询'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.import))
                operations.push(<Button key="import" href={`#${routes.import.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.import',
                    defaultMessage: '批量导入'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.auto))
                operations.push(<WrappedPopconfirm
                    id="auto"
                    key="auto"
                    placement="topLeft"
                    onConfirm={this.onClickAutoBtn}
                    title={this.props.intl.formatMessage({
                        id: 'queryPanel.validate.auto',
                        defaultMessage: '是否确认自动审核？'
                    })}>
                    <Button key="auto">{
                        this.props.intl.formatMessage({
                            id: 'queryPanel.auto',
                            defaultMessage: '自动审核'
                        })
                    }</Button>
                </WrappedPopconfirm>);
            if(hasPermissions(this.props.permissions, PERMISSION.autoSearch))
                operations.push(<Button key="autoSearch" href={`#${routes.autoQuery.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.autoSearch',
                    defaultMessage: '自动审核统计'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.approveAll))
                operations.push(<Button key="approveAll" href={`#${routes.approveAll.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.approveAll',
                    defaultMessage: '批量审核'
                })}</Button>);
            if(hasPermissions(this.props.permissions, PERMISSION.add))
                operations.push(<Button key="add" type="primary" href={`#${routes.add.url()}`}>{this.props.intl.formatMessage({
                    id: 'queryPanel.operation.add',
                    defaultMessage: '新增'
                })}</Button>);
        }
        return (
            <div className={styles.collapse}>
                <Spin spinning={this.state.loading}>
                    <Collapse>
                        <Panel key="1" header={<Row>
                            <Col span={2} className={styles.titleName}>
                                {this.props.intl.formatMessage({
                                    id: 'queryPanel.form.common',
                                    defaultMessage: '基础信息'
                                })}
                            </Col>
                            <Col span={22}>
                                <Row>
                                    <Form className="form-standard">
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.brandId',
                                                    defaultMessage: '品牌'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <div onClick={this.onClickStopPropagation}><WrappedSelect
                                                    allowClear
                                                    name="brandId"
                                                    value={this.props.conditions.brandId}
                                                    options={this.props.initEnum.brands}
                                                    onChange={this.handleFilterChange} /></div>
                                            </FormItem>
                                        </Col>
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.code',
                                                    defaultMessage: '索赔单号'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <div onClick={this.onClickStopPropagation}><TextInput
                                                    name="code"
                                                    value={this.props.conditions.code}
                                                    onPressEnter={this.handleFilterPressEnter}
                                                    onBlur={this.handleFilterChange} /></div>
                                            </FormItem>
                                        </Col>
                                    </Form>
                                </Row>
                            </Col>
                        </Row>}>
                            <Form className="form-standard">
                                <Row>
                                    {!this.props.isDealerUser &&
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.dealerId',
                                                    defaultMessage: '总代'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <DealerSelectPanel
                                                    conditions={dealerConditions}
                                                    value={dealerInfo}
                                                    onSelect={this.onSelectDealer} />
                                            </FormItem>
                                        </Col>
                                    }
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem class={styles.multiLabel}
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.subDealerCode',
                                                defaultMessage: '经销商编号'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <TextInput
                                                name="subDealerCode"
                                                value={this.props.conditions.subDealerCode}
                                                onPressEnter={this.handleFilterPressEnter}
                                                onBlur={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem class={styles.multiLabel}
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.repairCode',
                                                defaultMessage: '维修单号'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <TextInput
                                                name="repairCode"
                                                value={this.props.conditions.repairCode}
                                                onPressEnter={this.handleFilterPressEnter}
                                                onBlur={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                    {!this.props.isDealerUser && <Col {...FORM_OPTIONS.col}>
                                        <FormItem class={styles.multiLabel}
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.partCategory',
                                                defaultMessage: '主损件分类编号'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <SearchSelect
                                                allowClear
                                                value={partCategoryInfo}
                                                placeholder={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.faultMode.placeholder',
                                                    defaultMessage: '请输入备件分类名称或编号进行查询'
                                                })}
                                                onSelect={this.onSelectPartCategory}
                                                onSearch={this.onSearchPartCategory}
                                                keyIndex="id"
                                                labelMap={this.labelMap}
                                                onClickSearchBtn={this.onClickPartCategory} />
                                        </FormItem>
                                    </Col>}
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.repairType',
                                                defaultMessage: '索赔类型'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <WrappedSelect
                                                allowClear
                                                name="repairType"
                                                value={this.props.conditions.repairType}
                                                options={repairTypeList}
                                                onChange={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.faultItemId',
                                                defaultMessage: '故障代码'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <FaultItemSelectPanel
                                                value={faultItemInfo}
                                                onSelect={this.onClickFaultItem} />
                                        </FormItem>
                                    </Col>
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.approverName',
                                                defaultMessage: '审核人'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <TextInput
                                                name="approverName"
                                                value={this.props.conditions.approverName}
                                                onPressEnter={this.handleFilterPressEnter}
                                                onBlur={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>
                                    <Col>
                                        <FormItem label={this.props.intl.formatMessage({
                                            id: 'queryPanel.form.faultType',
                                            defaultMessage: '故障类型'
                                        })} {...FORM_ROW_OPTIONS.item}>
                                            <TagSelect
                                                name="faultType"
                                                value={this.props.conditions.faultType}
                                                options={faultTypeList}
                                                onChange={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>
                                    <Col>
                                        <FormItem label={this.props.intl.formatMessage({
                                            id: 'queryPanel.form.status',
                                            defaultMessage: '状态'
                                        })} {...FORM_ROW_OPTIONS.item}>
                                            <TagSelect
                                                name="status"
                                                value={this.props.conditions.status}
                                                options={this.props.isDealerUser ? claimStatusSale.toList(language) : claimStatus.toList(language)}
                                                onChange={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                </Row>
                            </Form>
                        </Panel>
                        <Panel key="2" header={<Row>
                            <Col span={2} className={styles.titleName}>
                                {this.props.intl.formatMessage({
                                    id: 'queryPanel.form.vehicle',
                                    defaultMessage: '车辆信息'
                                })}
                            </Col>
                            <Col span={22}>
                                <Row>
                                    <Form className="form-standard">
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.vin',
                                                    defaultMessage: 'VIN'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <div onClick={this.onClickStopPropagation}><TextInput
                                                    name="vin"
                                                    value={this.props.conditions.vin}
                                                    onPressEnter={this.handleFilterPressEnter}
                                                    onBlur={this.handleFilterChange} /></div>
                                            </FormItem>
                                        </Col>
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.productCategoryCode',
                                                    defaultMessage: '车型编号'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <div onClick={this.onClickStopPropagation}><MultipleSelect
                                                    name="productCategoryCode"
                                                    dataOptions={this.props.categories}
                                                    value={this.props.conditions.productCategoryCode}
                                                    onBlur={this.handleFilterChange} /></div>
                                            </FormItem>
                                        </Col>
                                    </Form>
                                </Row>
                            </Col>
                        </Row>}>
                            <Form className="form-standard">
                                <Row>
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.engineCode',
                                                defaultMessage: '发动机号'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <TextInput
                                                name="engineCode"
                                                value={this.props.conditions.engineCode}
                                                onPressEnter={this.handleFilterPressEnter}
                                                onBlur={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                    <Col {...FORM_OPTIONS.col}>
                                        <FormItem
                                            label={this.props.intl.formatMessage({
                                                id: 'queryPanel.form.transmissionSn',
                                                defaultMessage: '变速箱号'
                                            })}
                                            {...FORM_OPTIONS.item}>
                                            <TextInput
                                                name="transmissionSn"
                                                value={this.props.conditions.transmissionSn}
                                                onPressEnter={this.handleFilterPressEnter}
                                                onBlur={this.handleFilterChange} />
                                        </FormItem>
                                    </Col>
                                </Row>
                            </Form>
                        </Panel>
                        <Panel key="3" disabled={true} header={<Row>
                            <Col span={2} className={styles.titleName}>
                                {this.props.intl.formatMessage({
                                    id: 'queryPanel.form.part',
                                    defaultMessage: '备件信息'
                                })}
                            </Col>
                            <Col span={22}>
                                <Row>
                                    <Form className="form-standard">
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem class={styles.multiLabel}
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.causePartCode',
                                                    defaultMessage: '主损件编号'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <TextInput
                                                    name="causePartCode"
                                                    value={this.props.conditions.causePartCode}
                                                    onPressEnter={this.handleFilterPressEnter}
                                                    onBlur={this.handleFilterChange} />
                                            </FormItem>
                                        </Col>
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem class={styles.multiLabel}
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.causePartName',
                                                    defaultMessage: '主损件名称'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <TextInput
                                                    name="causePartName"
                                                    value={this.props.conditions.causePartName}
                                                    onPressEnter={this.handleFilterPressEnter}
                                                    onBlur={this.handleFilterChange} />
                                            </FormItem>
                                        </Col>
                                    </Form>
                                </Row>
                            </Col>
                        </Row>} />
                        <Panel key="4" disabled={true} header={<Row>
                            <Col span={2} className={styles.titleName}>
                                {this.props.intl.formatMessage({
                                    id: 'queryPanel.form.datatime',
                                    defaultMessage: '时间信息'
                                })}
                            </Col>
                            <Col span={22}>
                                <Row>
                                    <Form className="form-standard">
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.submitTime',
                                                    defaultMessage: '提交时间'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <DateRangePicker name="submitTime" value={this.props.conditions.submitTime}
                                                    onChange={this.handleFilterChange} />
                                            </FormItem>
                                        </Col>
                                        <Col {...FORM_OPTIONS.col}>
                                            <FormItem
                                                label={this.props.intl.formatMessage({
                                                    id: 'queryPanel.form.approveTime',
                                                    defaultMessage: '审核时间'
                                                })}
                                                {...FORM_OPTIONS.item}>
                                                <DateRangePicker name="approveTime" value={this.props.conditions.approveTime}
                                                    onChange={this.handleFilterChange} />
                                            </FormItem>
                                        </Col>
                                    </Form>
                                </Row>
                            </Col>
                        </Row>} />
                    </Collapse>
                    <Form className={styles.fromtop}>
                        <Row>
                            <Col span={6} className={styles['inline-button']}>
                                <Button key="query" type="primary" onClick={this.props.querySearch} loading={this.props.loading}>
                                    {this.props.intl.formatMessage({
                                        id: 'queryPanel.btn.query',
                                        defaultMessage: '查询'
                                    })}
                                </Button>
                                <Button key="clear" onClick={this.props.onResetClick}>
                                    {this.props.intl.formatMessage({
                                        id: 'queryPanel.btn.reset',
                                        defaultMessage: '重置'
                                    })}
                                </Button>
                            </Col>
                            <Col span={18} className="col-align-right">
                                {hasPermissions(this.props.permissions, PERMISSION.queryExport) && !isShowBatchPrintPanel && !isShowDownloadPanel &&
                                    <Export key={PERMISSION.queryExport} exportButton={this.props.intl.formatMessage({
                                        id: 'queryPanel.btn.exportButton',
                                        defaultMessage: '查询导出'
                                    })} exportRequest={this.props.onClickExport} />}
                                {hasPermissions(this.props.permissions, PERMISSION.settlementExport) && !isShowBatchPrintPanel && !isShowDownloadPanel &&
                                    <Export key={PERMISSION.settlementExport} exportButton={this.props.intl.formatMessage({
                                        id: 'queryPanel.btn.settlementButton',
                                        defaultMessage: '结算导出'
                                    })} exportRequest={this.props.onClickSettlementExport} />}
                                {operations}
                            </Col>
                        </Row>
                        {
                            this.state.showPartCategory &&
                            <PartCategorySelectPanel
                                selectKey={this.props.queryPartCategory.id}
                                onCancel={this.onClosePartCategory}
                                onSelect={this.onSelectPartCategory} />
                        }
                    </Form>
                </Spin>
            </div>
            
        );
    }
}

QueryPanel.propTypes = {
    conditions: PropTypes.object.isRequired,
    initEnum: PropTypes.object.isRequired,
    loading: PropTypes.bool.isRequired,
    permissions: PropTypes.array.isRequired,
    querySearch: PropTypes.func.isRequired,
    onClickDownloadBtn: PropTypes.func.isRequired,
    onClickExport: PropTypes.func.isRequired,
    onClickSettlementExport: PropTypes.func.isRequired,
    onConditionsChange: PropTypes.func.isRequired,
    onQueryDealerChange: PropTypes.func.isRequired,
    onResetClick: PropTypes.func.isRequired,
    categories: PropTypes.array,
    intl: PropTypes.object,
    isDealerUser: PropTypes.bool,
    queryDealer: PropTypes.object,
};

import {connect} from 'react-redux';
import {
    saveQueryCondition,
    resetQueryPanel,
    querySearch,
    saveQueryDealer,
    saveQueryPartCategory,
    saveQueryFaultItem,
    startBatchPrint,
    exportData,
    settlementExportData,
    startDownload
} from './actions';
import selectorFactory from 'Shared/utils/immutableToJsSelectorFactory';
import {createSelector} from 'reselect';

const getInitData = createSelector(
    state => state.getIn(['page', 'domainData', 'initData']),
    init => {
        const initData = init.toJS();
        const brands = initData.brands ? initData.brands.map(item => ({
            text: `${'('}${item.code}${')'}${item.name}`,
            value: item.id
        })) : [];
        return {
            brands
        };
    }
);

const getCategoryData = createSelector(
    state => state.getIn(['page', 'domainData', 'category']),
    init => {
        const initData = init.toJS();
        const categories = initData.data ? initData.data.map(item => ({
            code: item.code
        })) : [];
        return categories;
    }
);
const getConditions = selectorFactory(['page', 'appState', 'queryCondition']);
const getQueryDealer = selectorFactory(['page', 'appState', 'queryDealer']);
const getQueryPartCategory = selectorFactory(['page', 'appState', 'queryPartCategory']);
const getQueryFaultItem = selectorFactory(['page', 'appState', 'queryFaultItem']);
const getPermissions = selectorFactory(['page', 'domainData', 'permission', 'data']);
const mapStateToProps = state => ({
    loading: state.getIn((['page', 'domainData', 'list', 'isFetching'])),
    isDealerUser: state.getIn((['page', 'domainData', 'initData', 'isDealerUser'])),
    initEnum: getInitData(state),
    conditions: getConditions(state),
    queryDealer: getQueryDealer(state),
    queryPartCategory: getQueryPartCategory(state),
    queryFaultItem: getQueryFaultItem(state),
    permissions: getPermissions(state),
    isShowBatchPrintPanel: state.getIn(['page', 'ui', 'showBatchPrintPanel']),
    isShowDownloadPanel: state.getIn(['page', 'ui', 'showDownloadPanel']),
    categories: getCategoryData(state),
});

const mapDispatchToProps = dispatch => ({
    onConditionsChange: (name, value) => dispatch(saveQueryCondition(name, value)),
    onQueryDealerChange: data => dispatch(saveQueryDealer(data)),
    onQueryPartCategoryChange: data => dispatch(saveQueryPartCategory(data)),
    onQueryFaultItemChange: data => dispatch(saveQueryFaultItem(data)),
    querySearch: () => dispatch(querySearch()),
    onResetClick: () => dispatch(resetQueryPanel()),
    onClickBatchPrintBtn: () => dispatch(startBatchPrint()),
    onClickExport: () => dispatch(exportData()),
    onClickSettlementExport: () => dispatch(settlementExportData()),
    onClickDownloadBtn: () => dispatch(startDownload()),
});
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(QueryPanel));
